package com.example.JcGQS.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.JcGQS.mapper.AuditRelationshipMapper;
import com.example.JcGQS.mapper.InvoiceMapper;
import com.example.JcGQS.pojo.entity.AuditRelationship;
import com.example.JcGQS.pojo.entity.Invoice;
import org.apache.lucene.search.WildcardQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * invoiceDao
 * @author 末日
 * @date 2023/11/21
 */
@Component
public class InvoiceDao {
    @Autowired
    InvoiceMapper invoiceMapper;

    /**
     * 新增发票数据
     * @param invoice
     */
    public void InvoiceInsert(Invoice invoice){
        invoiceMapper.insert(invoice);
    }

    public Invoice InvoiceSelectId(Integer invoiceId){
        return invoiceMapper.selectById(invoiceId);
    }

    public Invoice InvoiceSelect(String order){
        return invoiceMapper.selectInsert(order);
    }
    /**
     * 修改发票信息
     */
    public void InvoiceUpdate(Integer invoiceId,Invoice invoice){
        UpdateWrapper<Invoice> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("invoice_id",invoiceId);
        invoiceMapper.update(invoice,updateWrapper);
    }
    public void deleteInvoice(Integer invoiceId){
  invoiceMapper.deleteById(invoiceId);
    }
}
